<?php
//No direct access
defined('_JEXEC') or die('Restricted access');
?>
<div id="ownservices">
 <div id="mainmenuownservice"><?php echo MenuHelper::nav(); ?></div>
	<div id="mainownservice">
	<h3><?php echo JText::_('OWNSERVICE_MEMBER_DETAIL'); ?></h3>
	<hr />
	<?php
		$dateformat  = OwnserviceHelper::getParams('date_format', '%d/%m/%Y');
		$row = $this->row;
	?>
	<form action="<?php echo JRoute::_('index.php?option=com_ownservice'); ?>" method="post" name="adminForm">
	<div class="cSubmenu">
		<ul class="submenu">
			<li><a href="#" onclick="javascript: submitbutton('detail')" class="active"><?php echo JText::_('OWNSERVICE_PERSONAL_DETAIL'); ?></a></li>
			<li><a href="#" onclick="javascript: submitbutton('account')"><?php echo JText::_('OWNSERVICE_ACCOUNTS'); ?></a></li>
			<li><a href="#" onclick="javascript: submitbutton('transfer')"><?php echo JText::_('OWNSERVICE_TRANSFER_HISTORYS'); ?></a></li>
		</ul>
	</div>
	<table width="100%">
		<tr>
			<td valign="top">
				<table class="admintable">
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_DATE'); ?></td>
						<td><?php echo JHTML::_('date', $row->created, $dateformat); ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_FIRSTNAME'); ?></td>
						<td><?php echo $row->firstname; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_LASTNAME'); ?></td>
						<td><?php echo $row->lastname; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_NICKNAME'); ?></td>
						<td><?php echo $row->nickname; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_USERNAME'); ?></td>
						<td><?php echo $row->username; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_BIRTHDAY'); ?></td>
						<td><?php echo JHTML::_('date', $row->birthday, $dateformat); ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_OCCUPATION'); ?></td>
						<td><?php echo $row->occupation; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_CURRENCY_EXCHANGE'); ?></td>
						<td><?php echo $row->currency; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_BRANCH'); ?></td>
						<td><?php echo $row->branchname; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_ID_TYPE'); ?></td>
						<td><?php echo $row->id_type; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_ID_NUMBER'); ?></td>
						<td><?php echo $row->id_number; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_EXPIRE_DATE'); ?></td>
						<td><?php echo JHTML::_('date', $row->expire_date, $dateformat); ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_ISSUER'); ?></td>
						<td><?php echo $row->issuer == 'Other'?$row->issuer_other:$row->issuer; ?></td>
					</tr>
					<tr>
						<td class="key"><strong><?php echo JText::_('OWNSERVICE_SECRET'); ?></strong></td>
						<td><strong><?php echo $row->secret; ?></strong></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_ADDRESS'); ?></td>
						<td><?php echo $row->address; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_CITY'); ?></td>
						<td><?php echo $row->city; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_STATE'); ?></td>
						<td><?php echo $row->state; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_POSTCODE'); ?></td>
						<td><?php echo $row->postcode; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_COUNTRY'); ?></td>
						<td><?php echo $row->country; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_PHONE'); ?></td>
						<td><?php echo $row->phone_no; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_EMAIL'); ?></td>
						<td><?php echo $row->email; ?></td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_LEVEL'); ?></td>
						<td><?php echo OwnserviceHelper::getUserLevel($row->user_id); ?></td>
					</tr>
					<tr>
						<td></td>
						<td>
							<table width="100%">
								<tr>
									<td width="60%">
										<div class="progress progress-striped">
										  <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo OwnserviceHelper::getPercentLevel(); ?>%">
										    <span class="sr-only"><?php echo OwnserviceHelper::getPercentLevel(); ?>% Complete (success)</span>
										  </div>
										</div>
									</td>
									<td style="vertical-align: top;">
										<?php echo OwnserviceHelper::getPercentLevel().'/100% (-'.OwnserviceHelper::getUplevel().' AUD) '; ?>
									</td>
								</tr>
							</table>	
						</td>
					</tr>
					<tr>
						<td class="key"><?php echo JText::_('OWNSERVICE_POINT'); ?></td>
						<td><?php echo OwnserviceHelper::getPoint($row->user_id); ?></td>
					</tr>
				</table>
			</td>
			<td valign="top" align="right">
				<table class="admintable">
					<tr>
						<td class="key" align="right"><?php echo ucwords($row->id_type); ?> :</td>
						<td>
							<?php 
							if(count($this->files) > 0){
								foreach($this->files as $file){
							?>
							<div style="margin-right: 5px;">
							<?php
									if(OwnserviceHelper::isImage($file->filename)):
							?>
										<a class="img-preview" href="<?php echo JURI::root(true).'/'.OwnserviceHelper::getParams('path', 'images/stories/ownservices').'/'.$row->user_id.'/'.$file->filename ?>"><img src="<?php echo JURI::root(true).'/'.OwnserviceHelper::getParams('path', 'images/stories/ownservices').'/'.$row->user_id.'/'.$file->filename ?>" style="border: 1px solid silver;" width="<?php echo $file->width; ?>" height="<?php echo $file->height; ?>" /></a>
							<?php 
									else:
										$icon = '';
										$icon	= JHTML::image(OwnserviceHelper::addIcon( $file ), $file->ext, 'class="icon-mime"') .'&nbsp;';
							?>
										<?php echo $icon ?><a href="index.php?option=com_ownservice&controller=user&task=download&id=<?php echo $file->id; ?>"><?php echo $file->filename; ?></a>
							<?php
									endif;
							?>
							</div>
							<?php
								}
							}
							?>
						</td>
					</tr>
				</table>
			</td>
			<tr>
				<td colspan="2"><hr /></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
				<input type="button" name="cancel" value="<?php echo JText::_('OWNSERVICE_BACK'); ?>" onClick="javascript:document.location.href='<?php echo JText::_('index.php?option=com_ownservice&view=members'); ?>';" />
				<?php if($this->access->canEdit || $this->access->canEditOwn):?><input type="submit" name="edit" value="<?php echo JText::_('OWNSERVICE_EDIT'); ?>" /><?php endif; ?>
				</td>
			</tr>
		</tr>
	</table>
	<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
	<input type="hidden" name="option" value="com_ownservice" />
	<input type="hidden" name="task" value="edit" />
	<input type="hidden" name="Itemid" value="<?php echo JRequest::getVar('Itemid'); ?>" />
	<input type="hidden" name="controller" value="member" />
	<input type="hidden" name="view" value="member" />
	<?php echo JHTML::_( 'form.token' ); ?>
		</form>
	</div>
</div>

